<?php
/**
 * Created by PhpStorm.
 * User: tengwei
 * Date: 2018/11/22
 * Time: 9:49 AM
 */

namespace common\logics\area;
use common\widgets\Request;
use common\widgets\Tool;
use yii\base\BaseObject;
use Yii;

class AreaLogic extends BaseObject implements IArea
{
    /** @var \common\sources\read\area\AreaAccess $RAreaAccess */
    private $RAreaAccess;

    public function init()
    {
        $this->RAreaAccess = Yii::$container->get('RAreaAccess');
        parent::init();
    }

    public function area($param)
    {
        // TODO: Implement area() method.
        if (!is_numeric($param['area_parent_id'])){
            return Tool::returnJson([],401,'地区父级id不能为空');
        }

        $areaName = $this->RAreaAccess->getArea($param);
        return Tool::returnJson($areaName,200,'查询成功');

    }
}

